package com.changzhi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changzhi.ldyl.model.ActivityRecord;
import com.changzhi.ldyl.model.vo.ChristmasRecordVo;
import com.changzhi.ldyl.model.vo.LoveVo;
import com.changzhi.ldyl.model.vo.UserVo;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 活动记录表 Mapper 接口
 * </p>
 *
 * @author huangrc
 * @since 2020-10-19
 */
public interface ActivityRecordMapper extends BaseMapper<ActivityRecord> {

	List<LoveVo> getLoveList();

	List<LoveVo> getRankingList(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime,@Param("giftIdList")  List<Integer> giftIdList);

	Long getTargetLoveNum(@Param("targetUserId") String targetUserId, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime,@Param("giftIdList")  List<Integer> giftIdList);

	Long getUserLoveNum(@Param("userId") String userId, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime,@Param("giftIdList")  List<Integer> giftIdList);

	List<Map<String,Object>> selectGiftByTargetId();

	List<ChristmasRecordVo> selectListByChristmas(@Param("giftIdList") List<Integer> giftIdList);

	int updateByStatus(Integer id);

	void addNum(@Param("id") Integer id, @Param("num") Integer num);

	List<UserVo> selectNumRankings(@Param("activityId") Integer activityId, @Param("type") Integer type);

	ActivityRecord selectMaxValueGroupByTargetId(@Param("activityId") Integer activityId, @Param("targetId") String targetId);

	ActivityRecord selectMaxValueDayByTargetId(@Param("activityId") Integer activityId, @Param("targetId") String targetId, @Param("createDate") LocalDate createDate);
}
